package com.wash.shoes.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wash.shoes.annotation.DataPermission;
import com.wash.shoes.domain.dto.ShopPageDto;
import com.wash.shoes.entity.ShopPo;
import com.wash.shoes.resp.WashShopVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 店铺系统的店铺 Mapper 接口
 * </p>
 *
 * @author zhengyunpeng
 * @since 2024-08-27
 */
public interface ShopMapper extends BaseMapper<ShopPo> {

    /**
     * 获取指定抖音店铺的所有启用的poid
     *
     * @param brandId 品牌id
     * @return
     */
    @Select("select DISTINCT poid from os_shop where brand_id = #{brandId} and channel='DY' and status=1 and poid is not null")
    List<String> getAllDyPoidWithBrandId(@Param("brandId") String brandId);

    /**
     * 分页查询
     *
     * @param page
     * @param shopPo
     * @return
     */
    @DataPermission(type = "shop", field = "id", tableAlias = "os")
    List<ShopPo> pageList(@Param("page") Page page, @Param("shopPo") ShopPageDto shopPo);

    /**
     * @author lijianguo
     * @Date 13/09/2024 请输入方法的简介
     **/
    ShopPo getShopByName(@Param("shopName") String shopName);

    /**
     * @author lijianguo
     * @Date 16/09/2024 请输入方法的简介
     **/
    ShopPo getByOpBizCode(@Param("opBizCode") String opBizCode);

    /**
     * @author lijianguo
     * @Date 22/09/2024 请输入方法的简介
     **/
    List<ShopPo> getAllShop();

    /**
     * @param provinces
     * @return
     */
    ShopPo getOneShopByProvinces(@Param("provinces") String provinces, @Param("city") String city, @Param("channel") String channel, @Param("brandId") String brandId);

    /**
     * @param poId
     * @return
     */
    String getShopIdByPoId(String poId);

    /**
     * @param shopId
     * @return
     */
    String getPoIdByShopId(String shopId);

    /**
     * 根据shopId查询店铺信息
     *
     * @param shopIdStr
     * @return
     */
    List<ShopPo> getShopByShopIds(@Param("shopIdStr") String shopIdStr);

    /**
     * 获取清洗的店铺
     *
     * @return
     */
    List<WashShopVo> washShopList();

    /**
     * 根据用户id获取他绑定的品牌id
     *
     * @return
     */
    List<String> getBrandIdByUserId(@Param("userId") Long userId);
}
